// 引入mongoose
const mongoose = require('mongoose');
const {adminsinfo} = require('./data/admins.js');

// 创建模型
const adminsScheme = new mongoose.Schema({
    adminsname: String,
    adminspassword: String,
});

const adminsModel=mongoose.model("admins", adminsScheme, "admins");

mongoose.connect("mongodb://tangzhenhua:Lovo123456@182.92.214.223:8084/maiwenjie", {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    auth: { authSource: "admin" }
},
    async () => {
        // 当连接成功后触发
        // 创建电影数据 一个（对象）或多个（数组）
        await adminsModel.create(adminsinfo);
        // console.log(122);
    })